<?php 



try{
	$db = new PDO("dbtype:host=yourhost;dbname=yourdbname;charset=utf8","username","password");
	

	$sth = $dbh->prepare('SELECT name, colour, calories
	    FROM fruit
	    WHERE calories < :calories AND colour = :colour');


	$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
	$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);

	$calories = 150;

	$colour = 'red';

	$sth->execute();

}catch(PDOException  $e ){
	echo "Error: ".$e;
}



// try{
// 	$db = new PDO("dbtype:host=yourhost;dbname=yourdbname;charset=utf8","username","password");

// 	$query=$db->prepare("Select * from table where id=? and name=?");

// 	$query->excute(array(23,'小马'));


// }catch(PDOException  $e ){
// 	echo "Error: ".$e;
// }

 ?>